package com.byd.sealmanage.handler;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * 全局异常处理类
 * @author fm
 * @date 2021/06/26
 */
@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    public ModelAndView exceptionHandlerPage (Exception e) {
        System.out.println("错误"+e.getMessage());
        ModelAndView modelAndView = new ModelAndView();;
        modelAndView.setViewName("page/404");
        return modelAndView;
    }
}
